import type { GetCodeParams, LoginByCodeParams, LoginDataType, LoginParams, UserData } from '@/type/user'
import request from '@/utils/request'

export const loginByPasswordAPI = (data: LoginParams) => {
  return request.post<null, LoginDataType>('/login/password', data)
}

export const getCodeAPI = (params: GetCodeParams) => {
  return request.get<null, { code: string }>('/code', { params })
}

export const loginByCodeAPI = (data: LoginByCodeParams) => {
  return request.post<null, LoginDataType>('/login', data)
}

export const userInfoAPI = () => {
  return request.get<null, UserData>('/patient/myUser')
}
